package homework;

public class java11 {
	public static void main(String[] args) {
		int[] arr= {1,2,3,4,5,6,7,8,9};
		int i=20;
		int[] arr1=getarr(arr,2,6);
		boolean a=judge(arr,i);
		System.out.println(a);
		a=judge(arr,3);
		System.out.println(a);
		for(i=0;i<arr1.length;i++) {
			System.out.print(arr1[i]+" ");
		}
	}
	
	public static boolean judge(int[] test,int a) {
		for(int i=0;i<test.length;i++) {
			if(test[i]==a) {
				return true;
			}
		}
		return false;
	}
	
	public static int[] getarr(int[] test,int a,int b) {
		int[] demo=new int[b-a+1];
		for(int i=0;i<b-a+1;i++) {
			demo[i]=test[a+i];
		}
		return demo;
	}
}